import { ColumnsRenderFun, formatDecimal, getSorter } from '../../Acommon';
import { Tooltip } from 'antd';
import pageStyles from '@/common/pageLayout.less';

export const IntentProjectColumns = (): Record<string, any>[] => {
  return [
    {
      title: '采购项目名称',
      dataIndex: 'applyTitle',
      key: 'applyTitle',
      visible: true,
      width: 280,
      fixed: 'left',
      sorter: (a: any, b: any) => getSorter(a?.applyTitle, b?.applyTitle),
      render: (text: string, record: Record<string, any>) => ColumnsRenderFun({ text, isTooltip: true }),
    },
    {
      title: '标的来源',
      dataIndex: 'supplyWay',
      key: 'supplyWay',
      visible: true,
      // fixed: 'left',
      sorter: (a: any, b: any) => getSorter(a?.supplyWay, b?.supplyWay),
      width: 160,
      render: (text: string) => {
        return (
          <Tooltip>
            <span className={pageStyles['over-flow-hidden']}>{text == '0' ? '月度计划' : text == '1' ? '零星采购' : text == '2' ? '实验平台' : '--'}</span>
          </Tooltip>
        );
      },
    },
    {
      title: '承办部门/团队',
      dataIndex: 'applyDepartmentName',
      key: 'applyDepartmentName',
      width: 170,
      visible: true,
      // fixed: 'left',
      sorter: (a: any, b: any) => getSorter(a?.applyDepartmentID, b?.applyDepartmentID),
      render: (text: string) => ColumnsRenderFun({ text, isTooltip: true }),
    },

    {
      title: '预估总价(元)',
      dataIndex: 'expectSum',
      key: 'expectSum',
      visible: true,
      sorter: (a: any, b: any) => getSorter(a?.expectSum, b?.expectSum),
      width: 150,
      render: (text: number) => <span>{formatDecimal(text)}</span>,
    },
    {
      title: '联系人',
      dataIndex: 'createrName',
      key: 'createrName',
      sorter: (a: any, b: any) => getSorter(a?.createrName, b?.createrName),
      visible: true,
      width: 150,
      render: (text: string) => ColumnsRenderFun({ text }),
    },
    {
      title: '联系电话',
      dataIndex: 'contactMobile',
      key: 'contactMobile',
      sorter: (a: any, b: any) => getSorter(a?.contactMobile, b?.contactMobile),
      visible: true,
      width: 150,
      render: (text: string) => ColumnsRenderFun({ text }),
    },
  ];
};
